/**
 * 登录注册找回密码API
 *
 * @版权所有 rem.studio
 */
import request from '@/utils/request';
import { getParamsSuffix } from '@/utils/paramsUtils';

/**
 * 获取安徽省下的所有行政区划
 * @returns {Promise<any>}
 */
export async function listAllAnhuiRegions() {
  return request('/api/swservice/v1/sw/listAllAnhuiRegions');
}

/**
 * 获取行业代码
 * @returns {Promise<any>}
 */
export async function queryBusinessCodes(query) {
  const params = getParamsSuffix(query);
  return request(`/api/swservice/v1/sw/queryBusinessCodes?${params}`, {
    method: 'GET',
  });
}

/**
 * 模糊查询企业信息
 * @param query
 * @returns {Promise<any>}
 */
export async function listAllByCompanyName(query) {
  const params = getParamsSuffix(query);
  return request(`/api/swservice/v1/sw/listAllByCompanyName?${params}`, {
    method: 'GET',
  });
}

/**
 * 分页获取企业列表数据
 * @param query
 * @returns {Promise<any>}
 */
export async function listAllCompanyInfos(query) {
  const params = getParamsSuffix(query);
  return request(`/api/swservice/v1/sw/listAllCompanyInfos?${params}`, {
    method: 'GET',
  });
}

/**
 * 新增企业信息
 * @param params
 * @returns {Promise<any>}
 */
export async function createNewCompany(params) {
  return request('/api/swservice/v1/sw/createNewCompany', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 更新企业信息
 * @param params
 * @returns {Promise<any>}
 */
export async function updateCompanyInfo(params) {
  return request('/api/swservice/v1/sw/updateCompanyInfo', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 删除企业信息
 * @param params
 * @returns {Promise<any>}
 */
export async function delCompanyInfo(params) {
  return request('/api/swservice/v1/sw/delCompanyInfo', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 智能锁获取数据
 * @param query
 * @returns {Promise<any>}
 */
export async function listAllLocksInfos(query) {
  const params = getParamsSuffix(query);
  return request(`/api/swservice/v1/sw/listAllLockInfos?${params}`, {
    method: 'GET',
  });
}

/**
 * 新增智能锁信息
 * @param params
 * @returns {Promise<any>}
 */
export async function createNewLock(params) {
  console.log(params)
  return request('/api/swservice/v1/sw/createNewLock', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 删除智能锁信息
 * @param params
 * @returns {Promise<any>}
 */
export async function deleteById(params) {
  console.log(params)
  return request('/api/swservice/v1/sw/delLockInfo', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 更新智能锁信息
 * @param params
 * @returns {Promise<any>}
 */
export async function updateLockInfo(params) {
  return request('/api/swservice/v1/sw/updateLockInfo', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

